
#include "Common.h"
#include "SystemV/AppLibSystemV_Sem.hpp"

int main (int argc, char **args)
{
    SINT32 i = 0;
	SINT32 SemId = -1;
	ULONG uRet = STAT_SUCCESS;

	if (argc != 2)
	{
		printf("Usage: ./SystemV_SemCli <Path>");
		return -1;
	}

	uRet = AppLibSystemV_SemCreate(args[1], 1, &SemId);
	if (uRet != STAT_SUCCESS)
	{
		printf("[%s %d] AppLibSystemV_SemCreate ret=%lu\n", __func__, __LINE__, uRet);
		return -2;
	}

    while (1)
    {
        AppLibSystemV_SemV_Wait(SemId, 0);
		printf("[%s %d] SemCli %d\n", __func__, __LINE__, ++i);
        usleep(100 * 1000);
    }

	return 0;
}


